package org.example;
import java.util.Random;
/**
 * 加减法口算练习系统-v0.1
 * 生成50道100以内加法/减法算式
 */
public class CalculationSystemV01 {
    public static void main(String[] args) {
        System.out.println("加减法口算练习系统-v0.1");
        System.out.println("========================");
        Random random = new Random();
        int totalQuestions = 50;
        for (int i = 0; i < totalQuestions; i++) {
            // 生成100以内的随机数
            int num1 = random.nextInt(100);
            int num2 = random.nextInt(100);
            // 随机选择加法或减法
            boolean isAddition = random.nextBoolean();
            // 生成算式字符串
            String expression;
            if (isAddition) {
                expression = num1 + " + " + num2 + " = ";
            } else {
                expression = num1 + " - " + num2 + " = ";
            }
            // 每行显示3个算式
            System.out.printf("%-20s", expression);
            if ((i + 1) % 3 == 0) {
                System.out.println();
            }
        }
        System.out.println("\n========================");
    }
}
